<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:o="http://openfaces.org/">

    <ui:composition template="/templatemnt.xhtml">
        <ui:define name="body">
            <h:form>
                <br/>
                <h:panelGrid columns="3" styleClass="panel">
                    <h:outputText value="#{bundle.EditPurchaseTitle}" styleClass="titulo"
                                  rendered="#{purchaseController.modo=='Edit'}">
                    </h:outputText>
                    <h:outputText value="#{bundle.CreatePurchaseTitle}" styleClass="titulo"
                                  rendered="#{purchaseController.modo=='Create'}">
                    </h:outputText>
                    <h:outputText value="#{bundle.ViewPurchaseTitle}" styleClass="titulo"
                                  rendered="#{purchaseController.modo=='View'}">
                    </h:outputText>
                    <h:outputText/>
                    <h:panelGrid columns="3" styleClass="panel_boton_m">
                        <h:messages id="msgs"
                                    errorStyle="color: red; background-color: #FF9797" 
                                    infoStyle="color: green; background-color: #99ff99 "/>
                        <h:commandButton rendered="#{purchaseController.modo!='View'}"
                                         action="#{purchaseController.confirma}" title="Save"
                                         image="/resources/img/guardar.png">
                        </h:commandButton>
                        <h:commandButton action="#{purchaseController.prepareList}" title="Cancel" 
                                         image="/resources/img/cancelar.png" immediate="true">
                        </h:commandButton>
                    </h:panelGrid>
                    <h:outputLabel value="#{bundle.EditPurchaseLabel_purchaseID}" for="purchaseID" />
                    <h:inputText id="purchaseID" value="#{purchaseController.selected.purchaseID}" 
                                 title="#{bundle.EditPurchaseTitle_purchaseID}" disabled="true"
                                 size="#{purchaseController.longCampo('purchaseID')}"/>
                    <h:outputText/>
                    <h:outputLabel value="#{bundle.EditPurchaseLabel_purchaseDate}" for="purchaseDate" />
                    <o:dateChooser id="purchaseDate" value="#{purchaseController.selected.purchaseDate}" label="#{bundle.EditPurchaseTitle_purchaseDate}" 
                                   required="#{purchaseController.campoNulo('purchaseDate')}"
                                   disabled="#{purchaseController.modo=='View'}">
                    </o:dateChooser>
                    <h:message for="purchaseDate" errorStyle="color: red" infoStyle="color: green"/>
                    <h:outputLabel value="#{bundle.EditPurchaseLabel_userID}" for="userID" />
                    <h:selectOneMenu id="userID" value="#{purchaseController.selected.userID}" title="#{bundle.EditPurchaseTitle_userID}" 
                                     required="true" requiredMessage="#{bundle.EditPurchaseRequiredMessage_userID}"
                                     disabled="#{purchaseController.modo=='View'}">
                        <f:selectItems value="#{userController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputText/>
                </h:panelGrid>
                <br />
            </h:form>
        </ui:define>
    </ui:composition>
</html>
